export const getClass = (target: any): any => {
  return target.prototype ? target : target.constructor
}

export const getClassOrSymbol = (target: any): any => {
  return typeof target === "symbol" ? target : getClass(target)
}

export const getClassName = (target: any): string => {
  return typeof target === "function" ? target.name : target.constructor.name
}

export const getBeanId = (target: any): string => {
  const className = getClassName(target)
  return className[0].toLowerCase() + className.substring(1)
}

export const buildMethodKey = (target, methodName: string): string => {
  return `${getClassName(target)}_${methodName}`
}

export function isFunction(functionToCheck) {
  return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]';
}

export function isAsyncFunction(fn){
  let fnStr =fn.toString()
  return Object.prototype.toString.call(fn) === '[object AsyncFunction]' || fnStr.includes("return _regenerator.default.async(function")
}
